home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / glibc-1.09 / glibc-1 / glibc-1.09.1 / sysdeps / generic / mathimpl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-07-31  |  4.2 KB  |  128 lines

  1. /* This part here added by roland@prep.ai.mit.edu for the GNU C library.  */
  2.    
  3. #include <math.h>        /* Done first so we can #undef.  */
  4. #include <endian.h>
  5. #if    __BYTE_ORDER == __LITTLE_ENDIAN
  6. #undef national
  7. #define national
  8. #endif
  9.  
  10. #undef    isinf
  11. #define    isinf    __isinf
  12. #undef    isnan
  13. #define    isnan    __isnan
  14. #undef    infnan
  15. #define    infnan    __infnan
  16. #undef    copysign
  17. #define    copysign    __copysign
  18. #undef    scalb
  19. #define    scalb    __scalb
  20. #undef    drem
  21. #define    drem    __drem
  22. #undef    logb
  23. #define    logb    __logb
  24. #undef    __finite
  25. #undef    finite
  26. #define    finite    __finite
  27. #undef    expm1
  28. #define    expm1    __expm1
  29.  
  30. /*
  31.  * Copyright (c) 1988, 1993
  32.  *    The Regents of the University of California.  All rights reserved.
  33.  *
  34.  * Redistribution and use in source and binary forms, with or without
  35.  * modification, are permitted provided that the following conditions
  36.  * are met:
  37.  * 1. Redistributions of source code must retain the above copyright
  38.  *    notice, this list of conditions and the following disclaimer.
  39.  * 2. Redistributions in binary form must reproduce the above copyright
  40.  *    notice, this list of conditions and the following disclaimer in the
  41.  *    documentation and/or other materials provided with the distribution.
  42.  * 3. All advertising materials mentioning features or use of this software
  43.  *    must display the following acknowledgement:
  44.  *    This product includes software developed by the University of
  45.  *    California, Berkeley and its contributors.
  46.  * 4. Neither the name of the University nor the names of its contributors
  47.  *    may be used to endorse or promote products derived from this software
  48.  *    without specific prior written permission.
  49.  *
  50.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  51.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  52.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  53.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  54.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  55.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  56.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  57.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  58.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  59.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  60.  * SUCH DAMAGE.
  61.  *
  62.  *    @(#)mathimpl.h    8.1 (Berkeley) 6/4/93
  63.  */
  64.  
  65. #include <sys/cdefs.h>
  66. #include <math.h>
  67.  
  68. #if defined(vax)||defined(tahoe)
  69.  
  70. /* Deal with different ways to concatenate in cpp */
  71. #  ifdef __STDC__
  72. #    define    cat3(a,b,c) a ## b ## c
  73. #  else
  74. #    define    cat3(a,b,c) a/**/b/**/c
  75. #  endif
  76.  
  77. /* Deal with vax/tahoe byte order issues */
  78. #  ifdef vax
  79. #    define    cat3t(a,b,c) cat3(a,b,c)
  80. #  else
  81. #    define    cat3t(a,b,c) cat3(a,c,b)
  82. #  endif
  83.  
  84. #  define vccast(name) (*(const double *)(cat3(name,,x)))
  85.  
  86.    /*
  87.     * Define a constant to high precision on a Vax or Tahoe.
  88.     *
  89.     * Args are the name to define, the decimal floating point value,
  90.     * four 16-bit chunks of the float value in hex
  91.     * (because the vax and tahoe differ in float format!), the power
  92.     * of 2 of the hex-float exponent, and the hex-float mantissa.
  93.     * Most of these arguments are not used at compile time; they are
  94.     * used in a post-check to make sure the constants were compiled
  95.     * correctly.
  96.     *
  97.     * People who want to use the constant will have to do their own
  98.     *     #define foo vccast(foo)
  99.     * since CPP cannot do this for them from inside another macro (sigh).
  100.     * We define "vccast" if this needs doing.
  101.     */
  102. #  define vc(name, value, x1,x2,x3,x4, bexp, xval) \
  103.     const static long cat3(name,,x)[] = {cat3t(0x,x1,x2), cat3t(0x,x3,x4)};
  104.  
  105. #  define ic(name, value, bexp, xval) ;
  106.  
  107. #else    /* vax or tahoe */
  108.  
  109.    /* Hooray, we have an IEEE machine */
  110. #  undef vccast
  111. #  define vc(name, value, x1,x2,x3,x4, bexp, xval) ;
  112.  
  113. #  define ic(name, value, bexp, xval) \
  114.     const static double name = value;
  115.  
  116. #endif    /* defined(vax)||defined(tahoe) */
  117.  
  118.  
  119. /*
  120.  * Functions internal to the math package, yet not static.
  121.  */
  122. extern double    __exp__E();
  123. extern double    __log__L();
  124.  
  125. struct Double {double a, b;};
  126. double __exp__D __P((double, double));
  127. struct Double __log__D __P((double));
  128.